include io.asm

stack segment stack
	dw 128 dup (?)
stack ends

;;======================================================================
data segment
	Head db "Vasilenko Anatoly. Group 111.$"
	Input db "Enter please number: $"
	Output db "Answer: $"
	
	number db 4 dup(' '), '$'
data ends
;;======================================================================

code segment 'code'
	assume ss:stack, ds:data, cs:code
start:
	mov ax,data
	mov ds,ax
	lea dx, Head
	outstr
	newline
	newline
	;;------------------------------------------------------------------
		lea dx, Input;
		outstr;
		
		inint ax;
		
		lea dx, Output;
		outstr;
		
		mov bx, 3;
		mov cx, 4;
		L:	mov dx, 0;
			mov di, 16;
			div di;
			
			cmp dl, 10;
			jae next1;
			add dl, '0';
			jmp short skip;
			next1:
			add dl, 'A'-10;
			skip:
			
			mov number[bx], dl;
			dec bx;
			
			loop L;
		
		lea dx, number[bx+1];
		outstr;
	;;------------------------------------------------------------------

the_end:
	newline;
	newline;
	mov ah,8
	int 21h
    finish
code ends

;;======================================================================
end start 

;;======================================================================
